package testing;

import gui.BotGui;
import httpbot.HttpRequests;
import httpbot.IRequests;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import bot.City;
import bot.Util;

public class testMain {
//	public static void main(String[] args){
//		File in = new File("c:\\Users\\Jamison\\Documents\\PopulationInfo\\Maine2Area.txt");
//		File out = new File("c:\\Users\\Jamison\\Documents\\PopulationInfo\\Maine2Area2.txt");
//		
//		try{
//			BufferedReader reader = new BufferedReader(new FileReader(in));
//			BufferedWriter writer = new BufferedWriter(new FileWriter(out));
//			String line = null;
//			String output = "";
//			while ((line = reader.readLine()) != null){
//				String test[] = line.split(" ");
//				for (int i = 0; i < test.length; i++){
//					if (i == 1){
//						output += test[i].substring(0, test[i].length() - 3) + " ";
//					}
//					else{
//						output += test[i] + " ";
//					}
//				}
//				output += "\n";
//				writer.write(output);
//				output = "";
//			}
//			reader.close();
//			writer.close();
//		}
//		catch (FileNotFoundException e){
//			e.printStackTrace();
//		}
//		catch (IOException e){
//			e.printStackTrace();
//		}
//	}
	
	public static void main(String args[]){
		
		IRequests requester = new HttpRequests();
		String result = requester.getPageSource("User:Jamo2008");
		sanatize(result);
	}
	
	private static String sanatize(String input){
		String split[] = input.split("\"wikitext\",\"*\":\"");
		String secondHalf = null;
		if (split.length == 2){
			secondHalf = split[1];
		}
		split = secondHalf.split("\\n");
		for (String s: split){
			System.out.println(s);
		}
		return null;
	}
}
